package controller;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.DTO.DishEditDTO;
import service.Impl.DishServiceImpl;
import util.GetJsonUtil;
import util.ResultUtil;

import java.io.IOException;

@WebServlet("/admin/dish/status/edit")
public class DishStatusController extends HttpServlet {
    //菜品状态（起售，停售）
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        DishEditDTO de=new DishEditDTO();
        DishServiceImpl ds=new DishServiceImpl();
        de.setId(Integer.parseInt(req.getParameter("id")));
        ds.statusEdit(de.getId());
        String json= ResultUtil.getJSON(null);
        resp.getWriter().println(json);
    }
}
